package es.upv.epsa.mobweb.moneyback;

import android.os.Bundle;
import android.view.Menu;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.app.Activity;
import android.content.Intent;

public class MainMenuActivity extends Activity implements OnClickListener {

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mainmenu);
		
		Button bAccounts = (Button)findViewById(R.id.accounts);
		Button bFriends = (Button)findViewById(R.id.friends);
		
		bAccounts.setOnClickListener(this);
		bFriends.setOnClickListener(this);
	}
	
	@Override
	public boolean onCreateOptionsMenu(Menu menu){
		//Inflate the menu; this adds items to the action bar if it is present
		getMenuInflater().inflate(R.menu.activity_main, menu);
		return true;
	}

	@Override
	public void onClick(View v) {
		switch(v.getId()){
		case R.id.accounts:
			accountsList();
			break;
		case R.id.friends:
			friendsList();
			break;
		}
				
	}
	
	private void accountsList(){
		Intent i = new Intent(this,AccountsListActivity.class);
		startActivity(i);
	}

	private void friendsList(){
		Intent i = new Intent(this,FriendsListActivity.class);
		startActivity(i);
	}
}
